/**
 * 
 */
package com.bar.galeriaRotatoria.bean;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 * @author pgonzalm
 *
 */
@ManagedBean (name = GaleriaRotatoriaBean.NAME_BEAN)
@ViewScoped
public class GaleriaRotatoriaBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public static final String NAME_BEAN = "galeriaRotatoriaBean";

//	private List<String> listaUbicaciones;
	
	private String image;
	
	private int contador;
	
	public GaleriaRotatoriaBean(){
		contador = 0;
		image = "/GaleriaRotatoria-portlet/images/imagenuno.jpg";
//		listaUbicaciones = new ArrayList<String>();
//		String directory = "images/principal";
//		String includes = null;
//		String excludes = null;
//		String[] files = FileUtil.find(directory, includes, excludes);
//		
//		if (files != null  && files.length > 0){
//			for(int i = 0; i<files.length; i++){
//				listaUbicaciones.add(files[i]);
//			}
//		}
		
	}
	
	public void cargar(){
		if (contador == 0){
			image = "/GaleriaRotatoria-portlet/images/imagendos.jpg";
			contador++;
		} else if (contador == 1){
			image = "/GaleriaRotatoria-portlet/images/imagentres.jpg";
			contador++;
		} else if (contador == 2){
			image = "/GaleriaRotatoria-portlet/images/imagencuatro.jpg";
			contador++;
		} else if (contador == 3){
			image = "/GaleriaRotatoria-portlet/images/imagenuno.jpg";
			contador = 0;
		}
		try {
			wait(3000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	/**
	 * @return the image
	 */
	public String getImage() {
		return image;
	}

	/**
	 * @param image the image to set
	 */
	public void setImage(String image) {
		this.image = image;
	}
	
}
